A consideration of Aryabhata's answer to the linked question shows that there is a map from the elliptic curve $y^2 = P(x)$ to the conic $v^2 = u^2 + 2$ given by
$$(x,y) \mapsto \left(x - \dfrac{1}{x}, \dfrac{y}{x}\right),$$
and the differential
$$\dfrac{1+x^2}{(1-x^2)\sqrt{1 + x^4}} \,\mathrm dx$$
on the elliptic curve is the pull-back of the differential
$$-\dfrac{1}{u v}\,\mathrm du$$
on the conic.
Since a conic has genus zero (i.e. it can be parameterized by a single variable,
using a classical "$t$-substitution"), the integral of a differential on a conic can always be expressed via elementary functions. Thus the same is true
of the integral of the original differential on the elliptic curve.
The answer to the general question is the same: if the differential in question can be pulled back from a map to a rational curve (i.e. a genus zero curve),
then the "elliptic integral" in question can be in fact integrated via elementary functions.
For example, any elliptic curve $y^2 = P(x)$ has a map to the the $x$-line given
by $(x,y) \mapsto x$. So if the integral only involves rational functions of $x$ (which will be the case when $y$ appears to even powers, since we can always
substitute $P(x)$ for $y^2$) then it can be computed in elementary terms. Also,
if $P(x)$ has repeated roots, then the curve $y^2 = P(x)$ itself is actually rational (it can be parameterized by a variation of the classical $t$-substitution for conics), and so any "elliptic integral" is actually elementarily integrable.
P.S. I have used some geometric terminology here (pull-back, differential, elliptic curve, rational curve) because the modern point of view on this material is via algebraic geometry. If some of this is unfamiliar, leave a comment and I (or someone else) can elaborate.
Added: If we have a curve $C$ (which could be our elliptic curve $y^2 = P(x)$,
or our rational curve $v^2 = u^2 + 2$, or just the $x$-line, or ...) and if $\omega$ is a differential on $C$, then finding the indefinite integral of $\omega$ means finding some function $f$ on $C$ such that $\omega = df$.
Now if $\varphi: C' \to C$ is a map of curves, then $\varphi^* \omega
= \varphi^* d f = d (f\circ \varphi).$ So $f\circ \varphi$ is an indefinite
integral of the pulled back differential $\varphi^*\omega$.
In particular, if $f$ is an elementary function of the coordinates on $C$,
and $\varphi$ is given by expressions which are elementary functions of the
coordinates, than the composite $f\circ \varphi$ will again be given by
elementary functions of the coordinates.
This is what is happening in your example.
Explicitly, on our curve $v^2 = u^2 + 2,$ we had for example the differential
$$-\dfrac{1}{u v} \,\mathrm du = -\frac{1}{2 u^2 v}\,\mathrm d (u^2 + 2) = -\frac{1}{2(v^2-2)v}\,\mathrm d(v^2) = -\dfrac{1}{v^2-2}\,\mathrm dv = -\dfrac{1}{2\sqrt{2}}\mathrm d\log\bigl( \frac{v-\sqrt{2}}{v+\sqrt{2}}\bigr).$$
Now pulling back this differential via our map $\varphi:(x,y)\mapsto \left(x-\dfrac{1}{x}, \dfrac{y}{x}\right)$ we obtain
$$\dfrac{1 + x^2}{(1-x^2)y}\,\mathrm dx = -\dfrac{1}{2\sqrt{2}}\mathrm d\log\bigl(\frac{y-\sqrt{2}x}{y+\sqrt{2}x} \bigr).$$
As this example shows, pulling back is just the theoretical terminology
for making a substitution, just as a map of curves is just theoretical terminology for a change of variables.
If memory serves, Miles Reid's wonderful book Undergraduate algebraic geometry discusses some of this, and in particular gives some of the history of how the analytic theory of elliptic integrals turned into the
algebro-geometric theory of elliptic curves. (If you don't know this book, don't be fooled by the title - it is a great introduction to the subject for someone at any level, not just undergraduates!) A much more detailed history can be found in Dieudonne's book on the history of algebraic geometry, but that book is probably not very readable unless you already have some feeling for algebraic geometry as a subject.