Try this. Both arrows should automatically expand base on the size of the matrix. You may want to shorten the horizontal arrow a bit, but it'd be hard to do without manually specifying the width of the matrix through the use of custom spacer such as \hphantom{\hrule{1cm}}
replacing the \hphantom
part of the code below, unless someone has better idea.
\documentclass{article}
\usepackage{mathtools}
\begin{document}
\newcommand{\mymatrix}[1]{\ensuremath{\left\downarrow\vphantom{#1}\right.\overset{\xrightarrow[\hphantom{#1}]{\text{variables}}}{#1}}}
\begin{equation*}
\text{\tiny observations}\mymatrix{\begin{pmatrix}
a_{1,1} & a_{1,2} & \cdots & a_{1,n} \\
a_{2,1} & a_{2,2} & \cdots & a_{2,n} \\
\vdots & \vdots & \ddots & \vdots \\
a_{m,1} & a_{m,2} & \cdots & a_{m,n}
\end{pmatrix}}
\end{equation*}
\end{document}
\documentclass{...}
and ending with\end{document}
.