Since the result of $\nabla\mathbf{f}$ gives us a second-rank tensor (it can be represented as a two-by-two matrix with components $\frac{\partial f^j}{\partial x^i}$), the usual vector basis $\mathbf{e}_i=(0,\cdots,1,0,\cdots,0)$ (where the one is in the $i^{th}$ place) doesn't quite cut it. However, we can generalize them. If we define the matrices $\mathbf{e}_i\mathbf{e}_j$ to have all zeroes except for a one in the $(i,j)$ spot, then the sum
$$\sum_{i,j=1}^n \frac{\partial f^j}{\partial x^i} \mathbf{e}_i\mathbf{e}_j$$
gives us the desired matrix, just as the sum $\sum_{i=1}^n \frac{\partial g}{\partial x^i} \mathbf{e}_i$ gives us $\nabla g$.
Properly, we should be writing $\mathbf{e}_i\bigotimes\mathbf{e}_j$ as we're actually dealing with the Kronecker product of $\mathbf{e}_i$ and $\mathbf{e}_j$, though in many contexts it seems people drop the direct sum symbol.