The Link between Stochastic Differential Equations with Non-Markovian Coefficients and Backward Stochastic Partial Differential Equations