Wavelet and reflectivity inversion (WRI) is an important issue in seismic data processing. To overcome the ill-posedness of WRI inversion with more efficient parameter selection and better lateral continuity of reflectivities, we propose a new WRI algorithm named compact smoothness and relative sparsity (CSRS) algorithm, where a normalized compact constraint and a normalized smooth regularization is proposed for the wavelet inversion, and a relative sparsity constraint is proposed for the reflectivity inversion. The proposed constraints and regularization make the parameters of WRI easy to be selected. The proposed relative sparsity constraint can lead to a reflectivity profile with good lateral continuity as it can be suitable for various seismic data with a fixed sparsity parameter. We also propose an efficient algorithm for solving corresponding WRI optimization problem. The whole WRI problem is divided into reflectivity inversion subproblem and wavelet inversion subproblem by using alternating iterative method, where the initial wavelet is estimated by smoothing the absolute amplitude spectrum of averaged seismic data. The proximal algorithm is applied to solve both reflectivity inversion subproblem and wavelet inversion subproblem. By replacing Toeplitz matrix multiplication with fast Fourier transform (FFT) and using compact wavelet, our algorithm can be efficient for 3D seismic data. The numerical examples on 2D synthetic data, 2D offshore field data and 3D onshore field data demonstrate that, compared to Toeplitz-sparse matrix factorization (TSMF) algorithm, the CSRS algorithm with fixed default parameters can get high-resolution reflectivities with better lateral continuity, and requires much less computational time.