W-algebras as coset vertex algebras