  We consider the $f(R,T)$ theory, where $R$ is the scalar curvature and $T$ is
the trace of energy-momentum tensor, as an effective description for the
holographic and new agegraphic dark energy and reconstruct the corresponding
$f(R,T)$ functions. In this study, we concentrate on two particular models of
$f(R,T)$ gravity namely, $R+2A(T)$ and $B(R)+\lambda{T}$. We conclude that the
derived $f(R,T)$ models can represent phantom or quintessence regimes of the
universe which are compatible with the current observational data. In addition,
the conditions to preserve the generalized second law of thermodynamics are
established.
