Consider the Black-Scholes model, in which the log stock return over a time period $\Delta t$ is given by
$$ \log(S_{i+1}/S_i) = (\mu - \sigma^2/2)\Delta t + \sigma \sqrt{\Delta t} Z_i, \qquad Z_i \sim \mathcal{N}(0,1). $$
The price of a call at time $T$ under this model (when we replace $\mu$ with $r$) is given by (emphasizing the dependence on $\sigma$)
$$ C(\sigma) = SN(d_1) - Ke^{-rT}N(d_2), $$
where
$$ d_1 = \frac{1}{\sigma{\sqrt{T}}}\left(\log(S/K) + (r + \sigma^2/2)T\right) = d_2 + \sigma \sqrt{T}. $$
Now, assuming $r$ is known, we have (at least) two methods of estimating $\sigma$, namely using a least-sqaures regression on the log returns, or calculating the implied vol.
Regression on log returns:
Note the log returns is a linear regression equation of the form
$$ Y_i = \beta_0 + \beta_1X_i + \sigma\sqrt{\Delta t} \epsilon_i $$
with $\beta_0 = (\mu - \sigma^2/2)\Delta t$, $\beta_1 = 0$ and $\epsilon_i \sim \mathcal{N}(0,1)$, independent. So, assuming we have a sample of $N$ log returns (denoted $Y_i$) and since $\beta_1 = 0$, we estimate $\beta_0$ in the usual regression way by
$$ \hat{\beta_0} = \frac{1}{N}\sum_{i=1}^N Y_i, $$ and then estimate $\sigma$ using the standard deviation of the residuals,
$$ \hat{\sigma} = \frac{std(Y_i - \hat{Y_i})}{\sqrt{\Delta t}}, $$
where the $\hat{Y_i}$ are the regression model-predicted log returns. This is one method to estimate $\sigma$ used in the pricing equation, and is in the least-sqaures sense our "best guess" at $\sigma$. This $\hat{\sigma}$ could then be used to compute all European call options for $S$ across all strikes and expirations.
Implied vol:
Given a market call price $C_{\text{observed}}$ for some strike and expiration, we can compute the $\sigma_{\text{implied}}$ such that $C(\sigma_{\text{implied}}) = C_{\text{observed}}$. We can compute such a $\sigma_{\text{implied}}$ for all call options we have prices for (again assuming $r$ is known). Then, when we would like to price a call using our pricing equation for some strike/expiration that is not observed, we can choose (or interpolate between a few) the $\sigma_{\text{implied}}$ that is closest to the strike/expiration we would like to price at and use this $\sigma_{\text{implied}}$ in our pricing equation.
So, we have two methods of deriving a suitable $\sigma$ to use in our pricing equation. It seems that much of the literature is devoted to implied vol, so I assume this is the preferred technique. My question is, is there any relation between the two, and when would you use one over the other?