Suppose I have a finite (non-)commutative ring $R/k$ (over a field $k$ of char $0$) with a linear “trace” function $t: R to k$. Can I find square matrices $A_1,dots,A_n$ (of some dimension $r$) so that I have an embedding $f: R to M_r(k)$ compatible with the trace functions on both sides?

One restriction I can see for the trace function on $R$ is that it should be invariant under cyclic permutations : $t(a_1a_2dots a_n) = t(a_2dots a_na_1)$. Is this the only restriction?