The only real big thing to consider is if you have an OS that is either 32bit or 64bit. Since if you have only 32bit, there's no point on installing any more than 4GB of ram, since it won't detect the rest.
You might want to consider if you want the computer running in dual channel mode or not, having either 2 or 4 memory slots used with similar memory type will let you run in dual channel. I would say that running in dual channel is maybe 3~5% faster than single channel.
I'm 100% sure that it will fit in both two computers, maybe 99.9% sure that it will work, however there is always that slight chance of incomptability.