Let $F$ be a real quadratic field with narrow class number one, and $f$ a Hilbert newform of weight $2$ and level
$\mathfrak{n}$ with rational Fourier coefficients, where $\mathfrak{n}$ is an integral ideal of $F$.
By the Eichler--Shimura construction, which is still a conjecture in many cases when $[F:\Q]>1$, there exists an elliptic curve
$E_f$ over $F$ attached to $f$. In this paper, we develop an algorithm that computes the (candidate) elliptic curve
$E_f$ under the assumption that the Eichler--Shimura conjecture is true. We give several illustrative examples that explain among
other things how to compute modular elliptic curves with everywhere good reduction. Over real quadratic fields, such curves do not admit
any parameterization by Shimura curves, and so the Eichler--Shimura construction is still conjectural in this case.