Create a macro, here \fxtxt
, which places the overtext entries in a fixed width box of appropriate width, here chosen as 3.5ex.
\documentclass{article}
\usepackage{amsmath}
\newcommand\fxtxt[1]{\makebox[3.5ex]{#1}}
\begin{document}
\[
\bordermatrix{\fxtxt{} & \fxtxt{all} & \fxtxt{dog} & \fxtxt{dogs} & \fxtxt{eat} & \fxtxt{fleas} & \fxtxt{go} & \fxtxt{has} & \fxtxt{heaven} & \fxtxt{in} & \fxtxt{is} & \fxtxt{it} & \fxtxt{my} & \fxtxt{no} & \fxtxt{to} & \fxtxt{world} \cr
D_1 & 0& 1& 0& 0& 1& 0& 1& 0& 0& 0& 0& 1& 0& 0& 0 \cr
D_2 &1& 0& 1& 0& 0& 1& 0& 1& 0& 0& 0& 0& 0& 1& 0 \cr
D_3 &0& 1& 0& 0& 1& 0& 1& 1& 1& 0& 0& 0& 1& 0& 0 \cr
D_4& 0& 2& 0& 1& 0& 0& 0& 0& 0& 1& 1& 0& 0& 0& 1}
\]
\end{document}

Follow up to OP query, merely redefining \fxtxt
to place at 45 degree angle, with narrower width and left alignment:
\documentclass{article}
\usepackage{amsmath,rotating}
\newcommand\fxtxt[1]{\rotatebox[origin=left]{45}{\makebox[3ex][l]{#1}}}
\begin{document}
\[
\bordermatrix{\fxtxt{} & \fxtxt{all} & \fxtxt{dog} & \fxtxt{dogs} & \fxtxt{eat} & \fxtxt{fleas} & \fxtxt{go} & \fxtxt{has} & \fxtxt{heaven} & \fxtxt{in} & \fxtxt{is} & \fxtxt{it} & \fxtxt{my} & \fxtxt{no} & \fxtxt{to} & \fxtxt{world} \cr
D_1 & 0& 1& 0& 0& 1& 0& 1& 0& 0& 0& 0& 1& 0& 0& 0 \cr
D_2 &1& 0& 1& 0& 0& 1& 0& 1& 0& 0& 0& 0& 0& 1& 0 \cr
D_3 &0& 1& 0& 0& 1& 0& 1& 1& 1& 0& 0& 0& 1& 0& 0 \cr
D_4& 0& 2& 0& 1& 0& 0& 0& 0& 0& 1& 1& 0& 0& 0& 1}
\]
\end{document}
