Density of states of many-body quantum systems from tensor networks