Distinguishing between histories of speciation and introgression using genomic data