In general, the time $t$ price of a zero-coupon bond maturing at time $T$ is given by
\begin{align*}
P(t,T) &= \mathbb{E}^\mathbb{Q}\left[\exp\left(-\int_t^T r_s\mathrm{d}s\right) \Bigg|\mathcal{F}_t\right].
\end{align*}
Here, $r_t$ is the short rate, i.e. the cost for borrowing time from $t$ until $t+\mathrm{d}t$. This formula follows directly from the absence of arbitrage.
If $r_t\equiv r$ is constant, then
\begin{align*}
P(t,T)=e^{-r(T-t)},
\end{align*}
which is the first formula you mentioned.
If $r_t$ is time-varying, you have to used the above equation with the conditional expectations. As it happens, in the Ho-Lee and the Hull-White models (and others too), this conditional expectation can be written as
\begin{align*}
P(t,T)=e^{A(t,T)+r_tB(t,T)},
\end{align*}
for suitable functions $A,B$, see here.
So both equations you mentioned are special cases of a more general formula. The first special case assumes constant interest rates, the second one assumes normally distributed short rates.