API's and functions related to cryptology are present in javax.crypto, not java.security.
I don't know Python, but given your description and the documentation of the methods shown, you want something along these lines:
final Charset charset = Charset.forName("ASCII");
final String secret = "mykey";
final String data = "A message to be turned to gibberish";
final String algorithm = "HmacSHA512";
byte[] keyBytes = secret.getBytes(charset);
SecretKeySpec signingKey = new SecretKeySpec(keyBytes, algorithm);
Mac mac = Mac.getInstance(algorithm);
mac.init(signingKey);
byte[] hashed = mac.doFinal(data.getBytes(charset));
System.out.println(new String(hashed, charset));
The code assumes byte and string conversions are based on ASCII (which I believe Python uses by default). You will in all likelihood have to tweak the logic, but its a good starting point.