Write the leftright-hand side as $Hom_B(P/P^2,B)$. If the map you are interested in is surjective, then the preimage of the trace ideal of $P/P^2$ in $B$ must be contained in the the trace ideal of $P$ in $A$. This is a serious obstruction.
For instance, if $P/P^2$ has a $B$-summand (equivalently, $trace_B(P/P^2)=B$) then it follows that $trace_A(P)=A$, which means $P$ has an $A$-summand, which forces $P$ to be principal. Thus, if $P$ is the maximal ideal, then $A$ must be a DVR (which is also sufficient).
Localizing at $P$, it follows that $A_P$ is regular and $P$ has height 1 for surjectivity to hold.