The Sturm-Liouville pencil is studied with arbitrary entire functions of the spectral parameter, contained in one of the boundary conditions. We solve the inverse problem, that consists in recovering the pencil coefficients from a part of the spectrum satisfying some conditions. Our main results are 1) uniqueness, 2) constructive solution, 3) local solvability and stability of the inverse problem. Our method is based on the reduction to the Sturm-Liouville problem without the spectral parameter in the boundary conditions. We use a special vector-functional Riesz-basis for that reduction.