Charge-to-spin conversion in inhomogeneous systems is studied theoretically. We consider free electrons subject to impurities with spin-orbit interaction and with spatially modulated distribution, and calculate spin accumulation and spin current induced by an external electric field. It is found that the spin accumulation is induced by the vorticity of electron flow through the side-jump and skew-scattering processes, and the differences of the two processes are discussed. The results can be put in a form of generalized spin diffusion equation with a spin source term given by the divergence of the spin Hall current. This spin source term reduces to the form of spin-vorticity coupling when the spin Hall angle is independent of impurity concentration. We also study the effects of long-range Coulomb interaction, which is indispensable when the process involves charge inhomogeneity and accumulation as in the present problem.