The Cohen-Macaulay and Gorenstein Rees algebras associated to filtrations