Modulational instability of dust-acoustic and dust-ion-acoustic waves