The difference is in the underlying hypothesis and what one is trying to verify:
If we know for sure that the spring is linear (i.e., $F=kx$ for any $x$), then the first method is just as good as the second. It is also the method to use when making multiple measurements for the same point (even if the spring is nonlinear, but spring constant is evaluated for each point separately).
On the other hand, if the issue of the linearity is itself to be checked, then the second method is the way to go. One could demonstrate this by plotting $F(x)$ for a non-linear restoring force: it is then clear why the first method would fail miserably. The second however is still applicable in the linear region (i.e., by trancating the dataset, to keep only small $x$).
Update
The question is really about statistics, rather than physics (and it could be a good diea to transfer it to Cross Validated).
Point estimate
In the first case we are performing a point estimate of the spring constant, $k$, provided the data $\{k_1, k_2,...,k_N\}$, using as estimator
$$
\hat{k}=\frac{1}{N}\sum_{i=1}^N k_i,
$$
whose error can be characterized by the standard deviation
$$
\sigma_k=\sqrt{\frac{1}{N-1}\sum_{i=1}^N(\hat{k}-k_i)^2}.
$$
That $k_i=F_i/X_i$ are not measured directly is a feature of particular setup - one could imagine a measurement device that measures directly $k$ rather than pairs $(x_i, F_i)$. Any such device would have an erorr, which could be accounted for in addition to the estimation error.
Such estimate could be done by repeatedly extending the spring to the same length - the procedure thus works, in principle, for non-linear springs. The focus here is the value of $k$, not the Hooke's law.
Regression analysis
In the second case one is performing regression analysis, verifying the Hooke's law (i.e., the linear relationship between the force and the extension of the spring). One than could use, e.g., the optimal least squares approach, minimizing
$$
f(k|\{x_i,F_i\}) = \frac{1}{N}\sum_{i=1}^N(kx_i-F_i)^2
$$
in respect to $k$. The standard deviation coudl then be calculated as the inverse of the Fisher information, and we could perform a statistical test to decide whether the spring is linear or not with the given level of confidence (for a physicist it rpetty much means comparing the estimated value of $k$ with its standard deviation, but there are more formal statistical procedures).
Remark
Optimal least squares is known to be very sensitive to outliers - one stray point may significantly affect the estimate. One therefore ofte resorts to robust regression, such as least absolute deviations, Theil-Sen estimator, or Huber regression. These require some numerics (apart from Theil-Sen), which is available in many statistical packages, e.g., in R or Python.