Nanomechanical electro-optical modulator based on atomic heterostructures