First, recall that $\mathrm{tr} A = \sum_i \langle i|A|i \rangle$. Each equation is then a sum where all terms are products of $P(z)$ and three other quantities. Further, the sum in the first equation ranges over a single index suggesting that all matrices under the trace are diagonal. In fact, since we are working with a composite system this also suggests that the basis in which the POVM elements are diagonal is the Schmidt basis of $\rho_{AB}$. At this point we could check which way of mapping the factors between the two equations works, but we don't have to do that since the superscripts on the POVM elements helpfully tell us the mapping.
Taking these observations into account we guess
$$
E_A^{x|y} = \sum_\lambda P(x|y,\lambda) |\lambda\rangle\langle\lambda| \\
E_B^{y|z} = \sum_\lambda P(y|\lambda,z) |\lambda\rangle\langle\lambda| \\
|\psi_{AB}\rangle = \sum_\lambda \sqrt{P(\lambda)} |\lambda\rangle|\lambda\rangle \\
\rho_{AB} = |\psi_{AB}\rangle\langle\psi_{AB}|
$$
where $|\lambda\rangle$ is an orthonormal basis. Now, $E_A^{x|y}$ is a valid POVM for fixed $y$ and similarly $E_B^{y|z}$ for fixed $z$. It is not clear from the question that this is the desired POVM structure, but it is what is suggested by the conditional sign in the superscripts.
Let's try our guess
$$
\begin{align}
P(x,y,z) &= P(z)\,\mathrm{tr}\left(\rho_{AB}(E_A^{x|y} \otimes E_B^{y|z})\right) \\
&= P(z) \sum_{\lambda_1,\lambda_2}\langle\lambda_1|\langle\lambda_2|\rho_{AB}\left(E_A^{x|y} \otimes E_B^{y|z}\right)|\lambda_1\rangle|\lambda_2\rangle \\
&= P(z) \sum_{\lambda_1,\lambda_2}\langle\lambda_1|\langle\lambda_2|\sum_{\lambda_3, \lambda_4} \sqrt{P(\lambda_3)P(\lambda_4)} |\lambda_3\rangle\langle\lambda_4| \otimes |\lambda_3\rangle\langle\lambda_4| \\ & \left(E_A^{x|y} \otimes E_B^{y|z}\right)|\lambda_1\rangle|\lambda_2\rangle \\
&= P(z) \sum_{\lambda_3,\lambda_4}\sqrt{P(\lambda_3)P(\lambda_4)}\langle\lambda_4|\langle\lambda_4|\left(E_A^{x|y} \otimes E_B^{y|z}\right)|\lambda_3\rangle|\lambda_3\rangle \\
&= P(z) \sum_{\lambda_3,\lambda_4}\sqrt{P(\lambda_3)P(\lambda_4)} \\ & \langle\lambda_4|\langle\lambda_4|\left(\sum_{\lambda_5} P(x|y,\lambda_5) |\lambda_5\rangle\langle\lambda_5| \otimes \sum_{\lambda_6} P(y|\lambda_6,z) |\lambda_6\rangle\langle\lambda_6|\right)|\lambda_3\rangle|\lambda_3\rangle \\
&= P(z) \sum_{\lambda}P(\lambda)P(x|y,\lambda) P(y|\lambda,z).
\end{align}
$$