This problem is essentially Corollary 3.4 in P. M. Cohn's Algebra, Volume 2, second edition (Section 4.3, pages 136-137). The idea is that the homomorphism from $M_n(R)$ to $T$ gives us a complete set of matrix units in $T$, and any ring with a complete set of matrix units is a full matrix ring.
Let $E_{ij}$ denote the standard matrix unit in $M_n(R)$, with a $1$ in the $i,j$ position and zeroes elsewhere. Set $e_{ij}=f(E_{ij})$. Then the $e_{ij}$, $1\le i,j\le n$, satisfy the rules $e_{ij}e_{kl}=\delta_{jk}e_{il}$ and $\sum_i e_{ii}=1$. Such a collection of elements is called a complete set of matrix units. Proposition 3.3 from Cohn's text says that if $T$ has a complete set of matrix units, then $T$ is isomorphic to $M_n(S)$, where $S$ is the centralizer of the matrix units. That is, $S=\{\,t\in T\mid e_{ij}t=te_{ij}\text{ for all }i,j\,\}$.
Here is an outline of the proof. Convention: $A,B$ will always be $n\times n$ matrices with $i,j$ entries $a_{ij}$, $b_{ij}$ respectively. We define $h:M_n(S)\to T$ by $h(A)=\sum_{i,j} a_{ij}e_{ij}$ and $g:T\to M_n(S)$ by $g(t)=A$, where $a_{ij}=\sum_k e_{ki}te_{jk}$. We should immediately verify that $a_{ij}\in S$. First note $e_{pq}a_{ij}=\sum_k e_{pq}e_{ki}te_{jk}=e_{pi}te_{jq}$, since the only nonzero summand occurs when $k=q$. A similar calculation shows $a_{ij}e_{pq}=e_{pi}te_{jq}$, so each $a_{ij}\in S$. Since the elements of $S$ commute with all the $e_{ij}$, the map $h$ is clearly a ring homomorphism. All that remains is to show $g$ and $h$ are inverses.
We show directly that $g$ and $h$ undo each other. First suppose $t\in T$, so $h(g(t))=\sum_{i,j,k} e_{ki}te_{jk}e_{ij}=\sum_{j,k} e_{kk}te_{jj}=(\sum_k e_{kk})t(\sum_j e_{jj})=1t1=t$. Next suppose $A\in M_n(S)$ and write $h(A)=\sum_{p,q}a_{pq}e_{pq}$, where the $a_{pq}$ commute with all of the matrix units. Then $g(h(A))=B$, where $b_{ij}=\sum_{k,p,q} e_{ki}a_{pq}e_{pq}e_{jk}=\sum_k a_{ij}e_{ki}e_{ij}e_{jk}$, since the summands are $0$ unless $p=i$ and $q=j$. This last sum equals $a_{ij}\sum_k e_{kk}=a_{ij}$. Thus $g(h(A))=A$.