You cannot always find such an embedding.  Consider the ring $R=\mathbb{Q}\langle x,y\rangle$ subject only to the condition that any monomial in the letters $x$ and $y$ of degree $3$ is zero.  This is a noncommutative ring, finite dimensional over $\mathbb{Q}$, and the natural factor map $t\colon R\to R/(x,y)\cong \mathbb{Q}$ is a ring homomorphism, and in particular it is linear.  Let $f\colon R\to \mathbb{M}_r(k)$ be any (possibly non-unital) ring homomorphism respecting this trace.  Then $f(1)$ must be a rank $1$ idempotent (since its trace is $1$).  Thus, since $f(1)$ acts as the identity on $f(R)$, we see that $f(R)\subseteq f(1)\mathbb{M}_r(k)f(1) \cong k$.  Hence $f$ is not an embedding, since $k$ has no zero-divisors.