The answer was given by Samuel Blank in his Brandeis 1967 phd dissertation, on which Poenaru gave a Bourbaki seminar.
Then Peter Shor and C. J. Van Wyk gave a polynomial time algorithm to decide if there is an extension.
EDIT: Blank's method already gave a polynomial algorithm, but with an exponent too large to make it practical, which is needed for applications (for instance to integrated circuit design).
The answer is in term of existence of a chain of "reductions" of a certain kind for the cyclically reduced word in the free group $F_n$ on $n$ generators determined by the immersion, where $n$ is the number of bounded components of the complement of the curve (assumed to have only transverse double points).

