Alphas from a time-series regression are error terms in the cross-sectional, linear relationship between expected returns and factor betas. If a factor model were correct those error terms (the alphas) would be zero.
Discussion
A carefully written version of a standard time-series regression of returns in excess of the risk free rate on market excess returns would be:
$$R_{i,t}-R^f_t = \alpha_i + \beta_i(R^m_t-R^f_t)+ \epsilon_{i,t}$$
This equation is NOT the CAPM. The CAPM is an economic theory that implies that the $\alpha_i$ for any security/portfolio $i$ in the above regression would be zero. Why is this the case?
The CAPM says that expected excess returns $\operatorname{E}[R_i - R^f]$ increase linearly in the regression beta $\beta_i$ of excess returns on market excess returns.
Below is a graph of what Prof. John Cochrane likes to call the cross-sectional implications of the time series regression. The intercepts $\alpha_i$ in time-series regressions are residuals in the cross-sectional regression where the regression line is defined by the two points $(0, 0)$ and $(1, \operatorname{E}[R_m] - r_f)$ [rather than being estimated by ordinary least squares]. The logic: if $\beta = 0$ then the excess return should be 0, and if $\beta = 1$, then the excess return should be $\operatorname{E}[R_m] - r_f$; the $\alpha_i$ are the deviations of each portfolio $i$ from that line.

Each blue circle represents a different security/portfolio. For each return series $i$, the estimated $\alpha_i$ from a time series regression is the vertical distance to the black line. If the CAPM were true, all those $\alpha_i$ would be zero and every security would be on that line.
What actually happens? Why does the CAPM not work?
The test assets in the figure below are the 25 Fama-French book to market and size portfolios. If the CAPM were true, each blue circle should lie on the black line, but that's not what happens!

What's even worse of the CAPM is not only are the deviations significant, the relationship, if anything, doesn't even go in the correct direction. The red line shows the estimated cross-sectional relationship between expected returns and market beta: it's estimated to be negative rather than positive. (The last figure is an old one I made for a prior class.)
The black line is the line defined by the two points $(0, 0)$ and $(1, \operatorname{E}[R_m] - r_f)$.
The intercept term $\alpha$ in a regression of excess returns on other excess returns (interpreted as risk factors) gives you an estimate of average returns that cannot be explained by those factors. Graphically, it's the vertical distance from the black line in the above graphs.
Let's say you run the following regression estimated with ordinary least squares:
$$ y_i = a + b x_i + \epsilon_i$$
Your estimate of $b$ will be:
$$ \hat{b} = \frac{\hat{\operatorname{Cov}}(y,x)}{\hat{\operatorname{Var}}(x)}$$
Where $\hat{\operatorname{Cov}}(y,x)$ is the sample covariance between $y$ and $x$ and $\hat{\operatorname{Var}}(x)$ is the sample variance of $x$.
So basically, your "two methods" of calculation are exactly the same thing.