The more technical answer is because the constrained optimization problem can be written in terms of Lagrange multipliers. In particular, the Lagrangian associated with the constrained optimization problem is given by
$$\mathcal L(\beta) = \underset{\beta}{\mathrm{argmin}}\,\left\{\sum_{i=1}^N \left(y_i - \sum_{j=1}^p x_{ij} \beta_j\right)^2\right\} + \mu \left\{(1-\alpha) \sum_{j=1}^p |\beta_j| + \alpha \sum_{j=1}^p \beta_j^2\right\}$$
where $\mu$ is a multiplier chosen to satisfy the constraints of the problem. The first order conditions (which are sufficient since you are working with nice proper convex functions) for this optimization problem can thus be obtained by differentiating the Lagrangian with respect to $\beta$ and setting the derivatives equal to 0 (it's a bit more nuanced since the LASSO part has undifferentiable points, but there are methods from convex analysis to generalize the derivative to make the first order condition still work). It is clear that these first order conditions are identical to the first order conditions of the unconstrained problem you wrote down.
However, I think it's useful to see why in general, with these optimization problems, it is often possible to think about the problem either through the lens of a constrained optimization problem or through the lens of an unconstrained problem. More concretely, suppose we have an unconstrained optimization problem of the following form:
$$\max_x f(x) + \lambda g(x)$$
We can always try to solve this optimization directly, but sometimes, it might make sense to break this problem into subcomponents. In particular, it is not hard to see that
$$\max_x f(x) + \lambda g(x) = \max_t \left(\max_x f(x)\ \mathrm{ s.t }\ g(x) = t\right) + \lambda t$$
So for a fixed value of $\lambda$ (and assuming the functions to be optimized actually achieve their optima), we can associate with it a value $t^*$ that solves the outer optimization problem. This gives us a sort of mapping from unconstrained optimization problems to constrained problems. In your particular setting, since everything is nicely behaved for elastic net regression, this mapping should in fact be one to one, so it will be useful to be able to switch between these two contexts depending on which is more useful to a particular application. In general, this relationship between constrained and unconstrained problems may be less well behaved, but it may still be useful to think about to what extent you can move between the constrained and unconstrained problem.
Edit: As requested, I will include a more concrete analysis for ridge regression, since it captures the main ideas while avoiding having to deal with the technicalities associated with the non-differentiability of the LASSO penalty. Recall, we are solving optimization problem (in matrix notation):
$$\underset{\beta}{\mathrm{argmin}} \left\{\sum_{i=1}^N y_i - x_i^T \beta\right\}\quad\mathrm{s.t.}\, ||\beta||^2 \leq M$$
Let $\beta^{OLS}$ be the OLS solution (i.e. when there is no constraint). Then I will focus on the case where $M < \left|\left|\beta^{OLS}\right|\right|$ (provided this exists) since otherwise, the constraint is uninteresting since it does not bind. The Lagrangian for this problem can be written
$$\mathcal L(\beta) = \underset{\beta}{\mathrm{argmin}} \left\{\sum_{i=1}^N y_i - x_i^T \beta\right\} - \mu\cdot||\beta||^2 \leq M$$
Then differentiating, we get first order conditions:
$$0 = -2 \left(\sum_{i=1}^N y_i x_i + \left(\sum_{i=1}^N x_i x_i^T + \mu I\right) \beta\right)$$
which is just a system of linear equations and hence can be solved:
$$\hat\beta = \left(\sum_{i=1}^N x_i x_i^T + \mu I\right)^{-1}\left(\sum_{i=1}^N y_i x_i\right)$$
for some choice of multiplier $\mu$. The multiplier is then simply chosen to make the constraint true, i.e. we need
$$\left(\left(\sum_{i=1}^N x_i x_i^T + \mu I\right)^{-1}\left(\sum_{i=1}^N y_i x_i\right)\right)^T\left(\left(\sum_{i=1}^N x_i x_i^T + \mu I\right)^{-1}\left(\sum_{i=1}^N y_i x_i\right)\right) = M$$
which exists since the LHS is monotonic in $\mu$. This equation gives an explicit mapping from multipliers $\mu \in (0,\infty)$ to constraints, $M \in \left(0, \left|\left|\beta^{OLS}\right|\right|\right)$ with
$$\lim_{\mu\to 0} M(\mu) = \left|\left|\beta^{OLS}\right|\right|$$
when the RHS exists and
$$\lim_{\mu \to \infty} M(\mu) = 0$$
This mapping actually corresponds to something quite intuitive. The envelope theorem tells us that $\mu(M)$ corresponds to the marginal decrease in error we get from a small relaxation of the constraint $M$. This explains why when $\mu \to 0$ corresponds to $M \to \left|\right|\beta^{OLS}\left|\right|$. Once the constraint is not binding, there is no value in relaxing it any more, which is why the multiplier vanishes.