Generalization Bounds via Information Density and Conditional Information Density