Sum rules for spectral densities of differential operators and generalized heat kernel expansion