Given the trace of a Matrix $\boldsymbol A$, its trace is defined as $\mathrm{tr} (\boldsymbol A) = \sum \limits_i A_{ii}$
We can think of the trace as a scalar function $f(A_{11},\dots,A_{nn}) = A_{11} + \dots + A_{nn}$ from $\mathbb{R}^n$ to $\mathbb{R}$.
Is there an inverse function for $f$?
Based on the discussion in here, Can a scalar-valued multivariate function be invertible?, scalar functions can have an inverse function. But I do not know if this applies for the trace function - if it can be treated at all as a scalar function.
Well, the simple answer is no unless your space is of dimension $1$. Otherwise you can always find different arguments/matrices having the same trace, thus you cannot revert the operation.