Transcription-coupled and epigenome-encoded mechanisms direct H3K4 methylation