Strong consistency of density estimation by orthogonal series methods for dependent variables with applications